<template>
  <a-modal
      title="定时任务日志"
      :width="1200"
      :visible="visible"
      :footer="null"
      :mask="true"
      @cancel="handleCancel"
      cancelText="关闭"
      wrapClassName="ant-modal-cust-warp"
      style="top:5%;height: 85%;overflow-y: hidden">


    <!-- table区域-begin -->
    <div style="overflow-x: auto">

      <a-table
        ref="table"
        bordered
        size="middle"
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        tableLayout="fixed"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">

      </a-table>
    </div>
    <!-- table区域-end -->
  </a-modal>
</template>

<script>
  import {TableListMixin} from '@/mixins/TableListMixin'
  import { postAction } from '@/api/manage'

  export default {
    name: "LogList",
    mixins: [TableListMixin],
    data() {
      return {
        loading: false,
        visible: false,
        queryParam: {},
        columns: [
          {
            title: '任务名称',
            align: "center",
            dataIndex: 'jobName',
            width: 120
          },
          {
            title: '执行时间',
            align: "center",
            width: 100,
            dataIndex: 'startTime',
          },
          {
            title: '结束时间',
            align: "center",
            width: 120,
            dataIndex: 'endTime'
          },
          {
            title: '用时(ms)',
            width: 80,
            align: "center",
            dataIndex: 'costSeconds'
          },
          {
            title: '异常信息',
            width:80,
            align:"center",
            ellipsis:true,
            dataIndex: 'exception'
          },
          {
            title: '操作结果',
            align: "center",
            width: 80,
            dataIndex: 'result',
          }
        ],
        url: {
          list: "/scheduleJobLog/getPageList",
        },
      }
    },
    methods:{
      init (jobName) {
        this.visible = true;
       //查询日志
        var params = this.getQueryParams();//查询条件
        params.jobName = jobName;
        this.loading = true;
        postAction(this.url.list, params).then((res) => {
          if (res.code == 200) {
            this.dataSource = res.result.list;
            this.ipagination.total = res.result.total;
          }
          this.loading = false;
        })
      },
      handleCancel () {
        this.$emit('ok');
        this.visible = false;
      },
    }

  }
</script>